package graphs;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import tester.Example;
import tester.TestMethod;
import tester.Tester;
import tester.cobertura.Instrument;
import java.awt.geom.*;
import java.util.ArrayList;
import lists.MyArrayList;

/**
 * <h1>Title : City</h1>
 * <p>Description : A City is identified by its name and location</p>
 * 
 * @author Adam Blackwell & Ryan Cassidy
 * @since February 25th 2009
 * @version 1.0
 */
@Instrument @Example public class City extends Vertex {
  private String state; // State Name.
  
  /**
   * The constructor.
   * 
   * @param name
   * @param neighbors
   * @param state
   * @param loc
   */
  public City(String name, MyArrayList<Link> neighbors, String state, Point loc) {
    super(name, neighbors, loc);
    this.state = state;
  }
  
  /**
   * Default Constructor :
   */
  public City() {
    super();
    this.state = "";
  }
  
//  /*
//   * Draw. (non-Javadoc)
//   * @see graphs.Vertex#draw(java.awt.Canvas)
//   */
//  @Override public void draw(Graphics g) {
//    int vertexSize = 20;
//    g.setColor(Color.BLACK);
//    g.drawOval(this.getLoc().x - (vertexSize / 2), this.getLoc().y - (vertexSize / 2), vertexSize, vertexSize);
//  }
//  
//  /**
//   * DrawLinks: Draws, on the given Graphics <code>g</code>, the
//   * neighbors of this given city.
//   * 
//   * @param c
//   */
//  public void drawLinks(Graphics g) {
//    MyArrayList<Link> i = this.neighbors;
//    for (Link l : i) {
//      l.draw(g, this);
//    }
//  }
  
  City c1, c2, c3;
  Link l1, l2, l3;
  
  /**
   * Init - Initializes test data for the test methods of this class.
   */
  public void init() {
    Link l1 = new Link(3, c1);
    Link l2 = new Link(3, c2);
    Link l3 = new Link(3, c3);
    c1 = new City("Boston", new MyArrayList<Link>(), "MA", new Point(20, 50));
    c2 = new City("Portland", new MyArrayList<Link>(), "ME", new Point(30, 20));
    c3 = new City("Concord", new MyArrayList<Link>(), "NH", new Point(25, 40));
    c2.neighbors.add(l1);
    c2.neighbors.add(l3);
    c1.neighbors.add(l2);
    c1.neighbors.add(l3);
    c3.neighbors.add(l1);
    c3.neighbors.add(l2);
  }
  
  /**
   * TestDraw - contains tests for the draw methods of this class.
   * 
   * @param t
   */
  @TestMethod public void testDraw(Tester t) {
    t.checkExpect(true);
  }
  
  /** <p>Getter Method.</p> */
  public String getState() {
    return this.state;
  }
  
  /**
   * <p> GetInfo : Compiles a string for the graph to put next to the node.</p>
   * 
   * @return Info
   */
  public String getInfo() {
    return this.getName() + ", " + this.getState();
  }
  
  public String toString() {
    return this.getName() + " " + this.state;
  }
}
